import { http } from "@/utils/http";
/** 上传图片 */
export const uploadImage = (file: File) => {
  return http.uploadImage("/common/upload/image", file);
};

/**
 * 反馈列表
 */
export const getFeedbackList = (data?: any) => {
  return http.request("post", "/admin/common/ques/list", { data });
};
/**
 * 获取反馈详情
 */
export const getFeedbackDetail = (data?: any) => {
  return http.request("post", "/admin/common/ques/info", { data });
};
/**
 * 更新反馈
 */
export const updateFeedback = (data?: any) => {
  return http.request("post", "/admin/common/ques/set", { data });
};
/**
 * 商务合作列表
 */
export const getCoopList = (data?: any) => {
  return http.request("post", "/admin/common/cooperate/list", { data });
};
/**
 * 商务合作详情
 */
export const getCoopDetail = (data?: any) => {
  return http.request("post", "/admin/common/cooperate/info", { data });
};
/**
 * 更新商务合作
 */
export const updateCoop = (data?: any) => {
  return http.request("post", "/admin/common/cooperate/set", { data });
};
/**
 * 获取公告列表 page pageSize
 *  {
                "noticeId": 1,
                "title": "测试公告信息",
                "content": "阿德飒飒大苏打阿萨大撒大苏打",
                "createdAt": "2025-04-09 17:33:44",
                "toType": 1,
                "readNum": 0
            }
 */
export const getNoticeList = (data?: any) => {
  return http.request("post", "/admin/common/notice/list", { data });
};
/**
 * 添加公告 page pageSize
 * 
 * {
    "title": "required|string",
    "toType": "required|integer", 推送类型(1:公告;2:客户;3:管理员)
    "content": "required|string",
    "uId": "integer"
}
 */
export const addNotice = (data?: any) => {
  return http.request("post", "/admin/common/notice/add", { data });
};
/**
 * 公告详情 
 * @param noticeId
 *  {
		"noticeId": 1,
		"title": "测试公告信息",
		"content": "阿德飒飒大苏打阿萨大撒大苏打",
		"createdAt": "2025-04-09 17:33:44",
		"readList": [
			{
				"isRead": 1,
				"account": "18800000000",
				"username": "18800000000"
			},
 */
export const getNoticeInfo = (noticeId: number) => {
  return http.request("post", "/admin/common/notice/info", {
    data: { noticeId }
  });
};
/**
 * 产品专区列表
 */
export const getActivityList = () => {
  return http.request("post", "/admin/common/activity/list");
};
/**
 * 修改产品专区
 */
export const setActivity = (data?: any) => {
  return http.request("post", "/admin/common/activity/set", { data });
};
/**
 * 获取banner列表  1-首页 2-商城的 type
 */
export const getBannerList = (data?: any) => {
  return http.request("post", "/admin/common/banner/list", {
    data
  });
};
/**
 * 添加banner
 *  "type": "required|integer",
    "image": "required|string",
    "link_type": "required|integer",
    "url": "string",
    "status": "integer",
    "weight": "integer"
 */
export const addBanner = (data?: any) => {
  return http.request("post", "/admin/common/banner/add", { data });
};
/**
 * 更新banner
 */
export const setBanner = (data?: any) => {
  return http.request("post", "/admin/common/banner/set", { data });
};
/**
 * 获取json数据
 */
export const getKeyVal = (key: string) => {
  return http.request("post", "/common/key/val", {
    data: {
      key
    }
  });
};
